//Copyright 2010 Balazs Keri, Imre Keri
//
//This file is part of FireworksCreator.
//
//FireworksCreator is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//FireworksCreator is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with FireworksCreator.  If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _MODEL_EMITTERTEMPLATE_H
#define _MODEL_EMITTERTEMPLATE_H
//
#include <global.h>
#include <common/identified.h>
#include <common/iddictionary.h>
#include "randomdouble.h"
#include "randomposition.h"
#include "particletemplate_fwd.h"
//
namespace model
{
class EmitterTemplate:public Identified
{
   Q_OBJECT
   Q_DISABLE_COPY(EmitterTemplate)
//structures
public:
   struct EmitterBlock
   {
      QString name;
      unsigned int amount;
      RandomDouble scale;
      bool synchronized;
      RandomPosition position;
      RandomPosition angle;
      RandomPosition angular_velocity;
      ParticleTemplate *particle;
      EmitterTemplate *emitter;
   //functions
      EmitterBlock();
      EmitterBlock(const EmitterBlock &p_other);
      EmitterBlock&operator=(const EmitterBlock &p_other);
   };
//construction
public:
   EmitterTemplate(QObject *p_parent=0);
   ~EmitterTemplate();
//data access
public:
   QString get_name()const;
   void set_name(QString p_name);
   void store_data(QDataStream &p_stream)const;
   void restore_data(RestoreStream &p_stream);
//data
public:
   QList<EmitterBlock> emitter_blocks;
protected:
   QString name;
};
}
//
QDataStream &operator<<(QDataStream &p_stream,const model::EmitterTemplate::EmitterBlock &p_eb);
RestoreStream &operator>>(RestoreStream &p_stream,model::EmitterTemplate::EmitterBlock &p_eb);
RestoreStream &operator>>(RestoreStream &p_stream,model::EmitterTemplate *&p_et);
//
#endif
